<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>窗口自适应</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .box{
            width: 100%;
            height: 100%;
            background: yellow;
        }
        .child1{
            height: 50%;
            background: red;
        }
        .child2{
            height: 50%;
            background: blue;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="child1"></div>
        <div class="child2"></div>
    </div>
</body>
</html>